<template>
  <div class="chatItemWrap" :class="{headerRight: (headerPos=='right')}">
    <Header class="headerBar" :src="headImg"/>
    <div class="chatItemContent">
      <span class="chatItemName" v-if="chatName">{{chatName}}</span>
      <span class="chatItemCon" v-if="chatContent">{{chatContent}}</span>
    </div>
  </div>
</template>

<script type='text/ecmascript-6'>
import Header from '@/views/comp/Header.vue';
export default {
  components: {
    Header
  },
  props: {
    chatName: null,
    chatContent: null,
    headerPos: '',
    headImg: null
  },
  data() {
    return {};
  },
  mounted() { },
  methods: {}
}
</script>

<style lang='scss' scoped>
.chatItemWrap {
  display: flex;
  &.headerRight {
    flex-direction: row-reverse;
    .chatItemName {
      text-align: right;
    }
    .chatItemCon {
      background: #9eea6a !important;
      &::after {
        top: 50%;
        left: auto !important;
        right: -5px;
        background: #9eea6a !important;
        border-left: none !important;
        border-bottom: none !important;
        border-top: 1px solid #9eea6a;
        border-right: 1px solid #9eea6a;
      }
    }
  }
  .headerBar {
    margin-top: 8px;
  }
  .chatItemContent {
    display: flex;
    flex-direction: column;
    margin: 0 10px;
    .chatItemName {
      font-size: 14px;
      color: #999;
      margin-bottom: 5px;
    }
    .chatItemCon {
      max-width: 350px;
      background: #fff;
      padding: 6px 12px;
      font-size: 14px;
      border-radius: 3px;
      border: 1px solid #e8e8e8;
      position: relative;
      opacity: 0.9;
      &:hover {
        opacity: 1;
      }
      &::after {
        position: absolute;
        content: " ";
        width: 8px;
        height: 8px;
        background: #fff;
        top: 10px;
        left: -5px;
        transform: rotate(45deg);
        border-left: 1px solid #e8e8e8;
        border-bottom: 1px solid #e8e8e8;
      }
    }
  }
}
</style>